package com.kang.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kang.pojo.ProvinceCity;
import com.kang.service.AssistService;
/**
 * 国家身份城市查询控制层
 * @author zs614
 * 
 */
@Controller
@RequestMapping("area")
public class AreaController {
	/**
	 * 通用服务层
	 */
	@Autowired
	private AssistService assistService;

	/**
	 * 查询所有国家
	 * @return
	 */
	@RequestMapping("getNationality")
	@ResponseBody
	public List<ProvinceCity> getNationality() {
		List<ProvinceCity> areas = assistService.queryAreas(0);
		return areas;
	}
	/**
	 * 根据国家查询省份
	 * @param id省份ID
	 * @return
	 */
	@RequestMapping("getProvince")
	@ResponseBody
	public List<ProvinceCity> getProvince(Integer id) {
		List<ProvinceCity> areas = assistService.queryAreas(id);
		return areas;
	}
	/**
	 * 根据省份查询城市
	 * @param id城市id
	 * @return
	 */
	@RequestMapping("getCity")
	@ResponseBody
	public List<ProvinceCity> getCity(Integer id) {
		List<ProvinceCity> areas = assistService.queryAreas(id);
		return areas;
	}
}
